package com.weipai.springboot.module.mapper;

import com.weipai.springboot.model.Admin;
import com.weipai.springboot.model.Customer;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Update;
import tk.mybatis.mapper.common.Mapper;
import tk.mybatis.mapper.common.MySqlMapper;

import java.util.List;
import java.util.Map;

/**
 * 管理员
 */
public interface AdminMapper extends Mapper<Admin>, MySqlMapper<Admin>{

    //查询管理员详情
    Admin getAdminById(String id);

    Admin getAdminByCustomerId(@Param("customerId") String customerId);

    //分页查询
    List<Map<String, Object>> selectAllByDel(@Param("del") int del, @Param("search") String search,
                                             @Param("sort") String sort, @Param("way") String way);

    //删除
    @Update("update c_admin set admin_del=-1, del_time=date_format(now(), '%Y-%m-%d %H:%i:%s') " +
            "where admin_id=#{id}")
    int updateDel(String id);

    //批量删除
    int batchDeleteById(String[] id);

    //通过邀请码查询员工
    Integer verifyCustomerByInviCode(String inviCode);

    Admin getAdminByLoginName(@Param("loginName") String loginName);

    int updateByPrimaryKey22(Admin admin);

    Admin getAdminByAdminCode(String adminCode);
}